package modelo;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "salon", catalog = "eventos_compartidos")
public class Salon implements java.io.Serializable {

	private static final long serialVersionUID = 1584087256206582340L;

	private Integer idSalon;
	private Domicilio domicilio;
	private String nombreSalon;
	private Set<TelefonoSalon> telefonosalons = new HashSet<TelefonoSalon>(0);
	private Set<Caracteristica> caracteristicas = new HashSet<Caracteristica>(0);
	private Set<TipoEvento> tipoeventos = new HashSet<TipoEvento>(0);

	public Salon() {
	}

	public Salon(String nombreSalon) {
		this.nombreSalon = nombreSalon;
	}

	// public Salon(Domicilio domicilio, String nombreSalon,
	// Set<Telefonosalon> telefonosalons,
	// Set<Caracteristicaxsalon> caracteristicaxsalons,
	// Set<Tipoevento> tipoeventos) {
	// this.domicilio = domicilio;
	// this.nombreSalon = nombreSalon;
	// this.telefonosalons = telefonosalons;
	// this.caracteristicaxsalons = caracteristicaxsalons;
	// this.tipoeventos = tipoeventos;
	// }

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idSalon", unique = true, nullable = false)
	public Integer getIdSalon() {
		return this.idSalon;
	}

	public void setIdSalon(Integer idSalon) {
		this.idSalon = idSalon;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "domicilio")
	public Domicilio getDomicilio() {
		return this.domicilio;
	}

	public void setDomicilio(Domicilio domicilio) {
		this.domicilio = domicilio;
	}

	@Column(name = "nombreSalon", nullable = false, length = 200)
	public String getNombreSalon() {
		return this.nombreSalon;
	}

	public void setNombreSalon(String nombreSalon) {
		this.nombreSalon = nombreSalon;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "salon")
	public Set<TelefonoSalon> getTelefonoSalons() {
		return this.telefonosalons;
	}

	public void setTelefonoSalons(Set<TelefonoSalon> telefonosalons) {
		this.telefonosalons = telefonosalons;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "salons")
	public Set<Caracteristica> getCaracteristicas() {
		return this.caracteristicas;
	}

	public void setCaracteristicas(Set<Caracteristica> caracteristicas) {
		this.caracteristicas = caracteristicas;
	}

	@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	@JoinTable(name = "tipoeventoxsalon", catalog = "eventos_compartidos", joinColumns = { @JoinColumn(name = "idSalon", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "idTipoEvento", nullable = false, updatable = false) })
	public Set<TipoEvento> getTipoeventos() {
		return this.tipoeventos;
	}

	public void setTipoeventos(Set<TipoEvento> tipoeventos) {
		this.tipoeventos = tipoeventos;
	}

}